<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=1200, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }
    h1 {
      display: block;
      width: 50vw;
      height: 50vw;
      background-color: blanchedalmond;
      text-align: center;
      line-height: 50vw;
      font-size: 50px;
      color: aquamarine;
    }
  </style>
</head>
<body>
  <h1>你好</h1>
  <br />
  <script>
    document.write(window.innerWidth);
  </script>
</body>
</html>